/*
 * icenter page
**/
<template>
<div>
<v-tab></v-tab>
<div class="mod-block-item"> </div>
<div class="page-mamber-quickbar mod-block-item">
  <div class="side fl" v-if="I9RIA">
    <span class="portrait"><img :src="I9RIA.headimgurl"></span>
    <p>{{I9RIA.nickname}}</p>
  </div>
  <div class="con fl">
    <h3>账户积分</h3>
    <p>{{scoreInfo}} <img src=".../../assets/imgs/credits.png"></p>
  </div>
  <div class="side-c fl">
    <router-link to="/records" class="btn-account-list"><h3>积分明细</h3><i><span v-if="!!integralState" class="weui-badge weui-badge_dot"></span></i></router-link>
  </div>
</div>
<div class="page__bd icenter-cell-list">
  <!-- <div class="weui-cells__title">历史数据</div> -->
  <div class="weui-cells">
  	<router-link :to="'/commrecord?score='+scoreInfo" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd"><img src="../../assets/imgs/icenter/i-10.png"></div>
      <div class="weui-cell__bd">
        <p>佣金记录</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
    <router-link to="/info" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd"><img src="../../assets/imgs/icenter/i-6.png"></div>
      <div class="weui-cell__bd">
        <p>兴趣爱好</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
    <router-link to="/goods" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd"><img src="../../assets/imgs/icenter/i-0.png"></div>
      <div class="weui-cell__bd">
        <p>我的玩赚</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
    <router-link to="/exchange" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd"><img src="../../assets/imgs/icenter/i-5.png"></div>
      <div class="weui-cell__bd">
        <p>我的兑换</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
    <router-link to="/olist" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd"><img src="../../assets/imgs/icenter/i-2.png"></div>
      <div class="weui-cell__bd">
        <p>我的订单</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
  </div>
  <!--<div class="weui-cells">
    <router-link to="/promotion" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd">
        <img src="../../assets/imgs/icenter/i-3.png">
        <span v-if="!showShareDct" class="weui-badge weui-badge_dot"></span>
      </div>
      <div class="weui-cell__bd">
        <p>邀请好友送积分</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
    <router-link to="/icenter" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd"><img src="../../assets/imgs/icenter/i-9.png" style="width:20px;margin-right:5px;display:block"></div>
      <div class="weui-cell__bd">
        <p>系统通知</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
    <router-link to="/faq" class="weui-cell weui-cell_access">
      <div class="weui-cell__hd"><img src="../../assets/imgs/icenter/i-8.png"></div>
      <div class="weui-cell__bd">
        <p>问题反馈</p>
      </div>
      <div class="weui-cell__ft"></div>
    </router-link>
  </div>-->
</div>
</div>
</template>
<script>
import vTab from 'components/common/tab'
import {getUserCredit} from '../../service/getData'
import {cookie} from 'src/config/utils'
import {mapState} from 'vuex'
export default {
  data () {
    return {
      showShareDct: false,
      shopList: {},
      scoreInfo: 0
    }
  },
  components: {
    'v-tab': vTab
  },
  mounted () {
    if (this.I9RIA && this.I9RIA.wxJsApiConf) {
      this.initData()
    }
  },
  activated () { // 更新个人中心的账户积分
    this.getUserCreditPoint()
  },
  computed: {
    ...mapState([
      'I9RIA', 'shareState', 'integralState'
    ])
  },
  methods: {
    async initData () {
      if (cookie('shareState') === 'shared') {
        this.showShareDct = true
      }
    },
    async getUserCreditPoint () {
      let tmpData = await getUserCredit()
      console.log(tmpData)
      if (tmpData.code !== 0) return
      this.scoreInfo = tmpData.data.credit_point
    }
  },
  watch: {
    I9RIA (res) {
      let val = res || {}
      if (val && val.wxJsApiConf) {
        this.initData()
      }
      if (val.code === 9999) {
        this.$router.push('/404')
      }
    }
  }
}
</script>
<style>
.page-mamber-quickbar{position:relative; height:1rem; overflow:hidden;}
.page-mamber-quickbar .side{ width:30%; height:100%; padding-top:.15rem; border-right:1px solid #d9d9d9; text-align:center; overflow:hidden; background:url(../../assets/imgs/bg-quickbar-side.png) no-repeat 0 0; background-size:100% auto}
.page-mamber-quickbar .side .portrait{width:.55rem; height:.55rem; display:block; margin:0 auto; overflow:hidden; background-color:#d9d9d9; border-radius:50%;}
.page-mamber-quickbar .side .portrait img{width:100%; height:100%; border-radius:50%; display:block;}
.page-mamber-quickbar .side > p{color:#4b4b4b; font-size:.12rem; line-height:.16rem; width:90%; margin:0 auto; white-space:nowrap;text-overflow:ellipsis; overflow:hidden; padding:.05rem 0 0;}
.page-mamber-quickbar .con{width:40%; height:100%; padding-top:.15rem; text-align:center; background:url(../../assets/imgs/bg-quickbar-con.png) no-repeat 0 0;}
.page-mamber-quickbar .con h3,
.btn-account-list h3{text-align:center; font-size:.14rem; color:#333; padding:.05rem 0}
.page-mamber-quickbar .con p{height:.26rem; color:#ffa200; font-size:.16rem; line-height:.26rem; padding-bottom:.05rem;}
.page-mamber-quickbar .con p img{height:.18rem; vertical-align:-.04rem;}
.page-mamber-quickbar .con div a{padding:0 .3rem;}
.page-mamber-quickbar .side-c{width:30%; height:100%; border-left:1px solid #d9d9d9;}
.page-mamber-quickbar .side-c a{width:100%; height:100%; padding-top:.15rem; display:block;}
.btn-account-list > i{position:relative; width:.24rem; height:.24rem; display:block; margin:0 auto; background-image:url(../../assets/imgs/2_03.png); background-size:.24rem .24rem; background-position:50% 50%; background-repeat:no-repeat;}
.icenter-cell-list .weui-cell__hd{ position:relative;}
.icenter-cell-list .weui-cell__hd img{width:.24rem;margin-right:.10rem;display:block}
.btn-account-list  .weui-badge_dot,
.icenter-cell-list .weui-cell__hd .weui-badge_dot{position:absolute; left:50%; top:50%; margin-left:.02rem; margin-top:-.12rem; padding:.04rem; border-radius:50%;}
.btn-account-list  .weui-badge_dot{margin-left:.05rem; margin-top:-.135rem;}
.icenter-cell-list .weui-cell__bd{font-size:.15rem;}
</style>
